<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改宿舍信息</title>
</head>
<body>
	<div id="win_update" class="easyui-window" title="修改宿舍信息" modal="true"
		closed="true" style="width: 500px; height: 300px; padding: 5px;">
		<div style="width: 430px; margin: 0px auto;">
		<div style="margin: 20px 0;"></div>
		
			<div style="padding: 10px 60px 20px 60px">
				<form id="ff_update" method="post">
					<table cellpadding="5">
						<tr style="display: none;">
							<td>宿舍编号:</td>
							<td><input class="easyui-textbox" type="text" name="roomId"
								data-options="required:true"></input></td>
						</tr>
						<tr>
							<td>宿舍名称:</td>
							<td><input class="easyui-textbox" type="text"
								name="roomName" data-options="required:true"></input></td>
						</tr>

						<tr>
							<td>信息备注:</td>
							<td><input class="easyui-textbox" type="text" name="roomInfo"
								data-options="multiline:true" style="height: 60px"></input></td>
						</tr>

					</table>
				</form>
				<div style="text-align: center; padding: 5px">
					<a href="javascript:void(0)" class="easyui-linkbutton"
						onclick="submitForm_update()">保存</a>
						<a href="javascript:void(0)" class="easyui-linkbutton"
						onclick="clearForm_update()">清除</a>
				</div>
			</div>
	</div>
	</div>
	<script type="text/javascript">
		function RoomUpdate(){
		var rows = $('#dg_room').datagrid('getChecked');
		if(rows.length==0){
			$.messager.show({
				title:'操作提示',
				msg:'请选择需要修改的记录，再点修改！',
				timeout:3000,
				showType:'slide'
			});
			return;
		}else if(rows.length>1){
			$.messager.show({
				title:'操作提示',
				msg:'请选择一条修改的记录，再点修改！',
				timeout:3000,
				showType:'slide'
			});
			return;
		}else{
			$('#ff_update').form('load','<%=request.getContextPath()%>/room/selectById?roomId='+rows[0]['roomId'])
			$('#win_update').window('open');
			
		}
		
		
	}
		function submitForm_update(){
			$('#ff_update').form({
				url:'<%=request.getContextPath()%>/room/updateRoom.json',
				onSubmit : function() {
					return $(this).form('validate');
				},
				success : function(data) {
					var d=JSON.parse(data);
					$.messager.show({
						title:'操作提示',
						msg:d.msg,
						timeout:5000,
						showType:'slide'
					});
					$('#win_update').window('close');
					$('#dg_room').datagrid('reload')
					
				}
			})

			$('#ff_update').submit()
		}
		function clearForm_update() {
			$('#ff_update').form('clear');
		}
		
	</script>
</body>
</html>